struct tmem_pool *pool;
int i;
- if ( (pool = tmem_alloc_infra(sizeof(struct tmem_pool),__alignof__(struct tmem_pool))) == NULL )
+ if ( (pool = xmalloc(struct tmem_pool)) == NULL )
return NULL;
for (i = 0; i < OBJ_HASH_BUCKETS; i++)
pool->obj_rb_root[i] = RB_ROOT;
INVERT_SENTINEL(pool,POOL);
pool->client = NULL;
list_del(&pool->pool_list);
- tmem_free_infra(pool);
+ xfree(pool);
}
/* register new_client as a user of this shared pool and return new
static struct client *client_create(domid_t cli_id)
{
- struct client *client = tmem_alloc_infra(sizeof(struct client),__alignof__(struct client));
+ struct client *client = xzalloc(struct client);
int i;
tmem_client_info("tmem: initializing tmem capability for %s=%d...",
tmem_client_err("failed... out of memory\n");
goto fail;
}
- memset(client,0,sizeof(struct client));
if ( (client->tmem = tmem_client_init(cli_id)) == NULL )
{
tmem_client_err("failed... can't allocate host-dependent part of client\n");
return client;
fail:
- tmem_free_infra(client);
+ xfree(client);
return NULL;
}
{
list_del(&client->client_list);
tmem_client_destroy(client->tmem);
- tmem_free_infra(client);
+ xfree(client);
}
/* flush all data from a client and, optionally, free it */
return (tmem_page_list_pages + total_free_pages()) >> (20 - PAGE_SHIFT);
}
-/*
- * Memory allocation for "infrastructure" data
- */
-
-static inline void *tmem_alloc_infra(size_t size, size_t align)
-{
- return _xmalloc(size,align);
-}
-
-static inline void tmem_free_infra(void *p)
-{
- return xfree(p);
-}
-
#define tmem_lock_all opt_tmem_lock
#define tmem_called_from_tmem(_memflags) (_memflags & MEMF_tmem)